import Vue from 'vue'
import App from './App'
import uView from '@/uni_modules/uview-ui'
// import websdk from "@/newSDK/uniapp-sdk-4.1.2";
import config from "@/utils/WebIMConfig";

Vue.use(uView)
// uni.$u.config.unit = 'rpx'
Vue.config.productionTip = false

// let WebIM = uni.WebIM = websdk;
// WebIM.config = config;
// WebIM.conn = new WebIM.connection({
// 	appKey: WebIM.config.appkey,
// 	url: WebIM.config.xmppURL,
// 	apiUrl: WebIM.config.apiURL,
// 	https: WebIM.config.https,
// });

// Vue.prototype.$WebIM = WebIM;

Vue.mixin({
	methods: {
		setData: function(obj, callback) {
			let that = this;
			let keys = [];
			let val, data;
			Object.keys(obj).forEach(function(key) {
				keys = key.split('.');
				val = obj[key];
				data = that.$data;
				keys.forEach(function(key2, index) {
					if (index + 1 == keys.length) {
						that.$set(data, key2, val);
					} else {
						if (!data[key2]) {
							that.$set(data, key2, {});
						}
					}
					data = data[key2];
				})
			});
			callback && callback();
		} 
	}
});

App.mpType = 'app'

const app = new Vue({
    ...App
})
app.$mount()
